var e = require;
var t = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("BaseModuleUI"),
    a = e("NotifyEventType"),
    i = e("GlobalParams"),
    r = e("AssetsManager"),
    s = e("AudioManager"),
    l = e("Game"),
    c = e("RoleSoldierInfo"),
    d = e("AD"),
    h = cc._decorator,
    _ = h.ccclass,
    u = h.property,
    p = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.kill_info_node = null),
                (t.kill_name = null),
                (t.be_kill_name = null),
                (t.kill_head = null),
                (t.be_kill_head = null),
                (t.kill_bg = []),
                (t.be_kill_bg = []),
                (t.kill_info_list = []),
                (t.show_kill_tip = !1),
                (t.rest_name = [
                    "士兵",
                    "士兵",
                    "超级兵",
                    "防御塔",
                    "烈焰犬",
                    "雷电龙狐",
                    "毒液蜘蛛",
                    "机械邪瑞",
                    "冰山巨兽"
                ]),
                (t.is_first = !0),
                (t.my_kill = 0),
                t
            );
        }
        return (
            __extends(t, e),
            (t.prototype.initView = function () {
                (this.is_first = !0),
                    (this.my_kill = 0),
                    (this.kill_info_node.active = !1),
                    (this.show_kill_tip = !1),
                    (this.kill_info_list = []);
            }),
            (t.prototype.addEvent = function () {
                this.attachEvent(a.default.SEND_ROLE_BE_KILL_INFO, this.showKillTipInfo, this);
            }),
            (t.prototype.showKillTipInfo = function (e, t) {
                if (-1 == [7, 8, 9].indexOf(t.be_kill)) {
                    var o = {
                        kill_name: "",
                        kill_head: "",
                        kill_id: 0,
                        is_red_ream: !1,
                        be_kill_name: "",
                        be_kill_head: "",
                        be_kill_id: 0
                    };
                    t.kill < 7
                        ? ((o.kill_name = i.GlobalParams.MatchGamePlayer[t.kill].name),
                          (o.kill_head = c.default.Role_info[i.GlobalParams.MatchGamePlayer[t.kill].role_id].C_ID))
                        : ((o.kill_name = this.rest_name[t.kill - 7]), (o.kill_head = t.kill)),
                        (o.kill_id = t.kill),
                        (o.is_red_ream = t.team == l.TeamInfo.left_team),
                        t.be_kill < 7
                            ? ((o.be_kill_name = i.GlobalParams.MatchGamePlayer[t.be_kill].name),
                              (o.be_kill_head =
                                  c.default.Role_info[i.GlobalParams.MatchGamePlayer[t.be_kill].role_id].C_ID))
                            : ((o.be_kill_name = this.rest_name[t.be_kill - 7]), (o.be_kill_head = t.be_kill)),
                        (o.be_kill_id = t.be_kill),
                        this.show_kill_tip
                            ? this.kill_info_list.push(o)
                            : ((this.show_kill_tip = !0), this.showKillInfo(o));
                }
            }),
            (t.prototype.showKillListInfo = function () {
                this.kill_info_list.length > 0
                    ? (this.showKillInfo(this.kill_info_list[0]), this.kill_info_list.splice(0, 1))
                    : (this.show_kill_tip = !1);
            }),
            (t.prototype.showKillInfo = function (e) {
                var t = this;
                if (
                    ((this.kill_name.string = "" + e.kill_name),
                    (this.be_kill_name.string = "" + e.be_kill_name),
                    (this.kill_head.spriteFrame = r.default.getInstance().getGameHoreHeadFrame(e.kill_head)),
                    (this.be_kill_head.spriteFrame = r.default.getInstance().getGameHoreHeadFrame(e.be_kill_head)),
                    (this.kill_bg[0].active = this.be_kill_bg[1].active = e.is_red_ream),
                    (this.kill_bg[1].active = this.be_kill_bg[0].active = !e.is_red_ream),
                    (this.kill_info_node.active = !0),
                    e.kill_id < 7 && e.be_kill_id < 7)
                )
                    if (
                        (e.be_kill_id != i.GlobalParams.MatchMyIndex ||
                            this.is_first ||
                            (this.my_kill > 2
                                ? s.default.getInstance().playFx("finality")
                                : s.default.getInstance().playFx("killYou"),
                            i.GlobalParams.gameShock.value && d.default.getInstance().vibrateShort()),
                        e.kill_id == i.GlobalParams.MatchMyIndex
                            ? (this.my_kill++, i.GlobalParams.gameShock.value && d.default.getInstance().vibrateShort())
                            : (this.my_kill = 0),
                        this.is_first)
                    )
                        (this.is_first = !1), s.default.getInstance().playFx("fristBlood");
                    else if (this.my_kill > 0) {
                        var o = "";
                        1 == this.my_kill && (o = "killEnemy"),
                            2 == this.my_kill && (o = "doubleKill"),
                            3 == this.my_kill && (o = "tripleKill"),
                            4 == this.my_kill && (o = "fourKill"),
                            5 == this.my_kill && (o = "fiveKill"),
                            6 == this.my_kill && (o = "sixKill"),
                            this.my_kill > 6 && (o = "sevenKill"),
                            s.default.getInstance().playFx(o);
                    }
                this.scheduleOnce(function () {
                    (t.kill_info_node.active = !1),
                        t.scheduleOnce(function () {
                            t.showKillListInfo();
                        }, 0.5);
                }, 2);
            }),
            __decorate([u(cc.Node)], t.prototype, "kill_info_node", void 0),
            __decorate([u(cc.Label)], t.prototype, "kill_name", void 0),
            __decorate([u(cc.Label)], t.prototype, "be_kill_name", void 0),
            __decorate([u(cc.Sprite)], t.prototype, "kill_head", void 0),
            __decorate([u(cc.Sprite)], t.prototype, "be_kill_head", void 0),
            __decorate([u(cc.Node)], t.prototype, "kill_bg", void 0),
            __decorate([u(cc.Node)], t.prototype, "be_kill_bg", void 0),
            __decorate([_], t)
        );
    })(n.default);
o.default = p;
